## First convert deduplicated bam files for libraries into bedfiles using bedtools. Sort these files. This is the input for ATAC-Seq part.

## For RNA-Seq part input is FPKM table for cells (cuffnorm output). Make sure cell numbers are same in ATAC and RNA inputs.

## Make sure to remove any gene from FPKM table not found in the "peak_gene_100k_corr.bed" output of the preproccessing step of coupleNMF.

## symbol.txt is the row names of the FPKM table (Make sure all names can be found in "peak_gene_100k_corr.bed"

## PeakO.txt, PeakName.txt, peak_gene_100k_corr.bed are output files from "preprocessing.sh" of coupleNMF software 


#Conversion of bam to bed:

bedtools bamtobed -i /Path/To/Bam/Library.bam > ./Path/To/Library.bed


##Sorting bed Files:

sort -k 1,1 -k2,2n /Path/To/Library.bed > /Path/To/Library_Sorted.bed

## Preprocessing Step for CoupleNMF:

##After filling the genome inside preprocessing.sh (mm9 for Mouse - hg19 for Human), make sure all sorted bed files are located in a folder called 'Bed'.

sh preprocessing.sh

## Then run the following command:

python /Path/To/coupleNMF.py -k <2 for figure 2 data/ 3 for for figure 4 data> -E /Path/To/FPKM/table.txt -PeakO PeakO.txt -E_symbol symbol.txt -P_symbol PeakName.txt -pe peak_gene_100k_corr.bed 


